# DocType Mapper, Sales Order-Delivery Note
[

	# These values are common in all dictionaries
	{
		'creation': '2010-08-08 17:09:35',
		'docstatus': 0,
		'modified': '2011-09-14 12:36:25',
		'modified_by': 'Administrator',
		'owner': 'Administrator'
	},

	# These values are common for all Table Mapper Detail
	{
		'doctype': 'Table Mapper Detail',
		'name': '__common__',
		'parent': 'Sales Order-Delivery Note',
		'parentfield': 'table_mapper_details',
		'parenttype': 'DocType Mapper'
	},

	# These values are common for all Field Mapper Detail
	{
		'doctype': 'Field Mapper Detail',
		'name': '__common__',
		'parent': 'Sales Order-Delivery Note',
		'parentfield': 'field_mapper_details',
		'parenttype': 'DocType Mapper'
	},

	# These values are common for all DocType Mapper
	{
		'doctype': u'DocType Mapper',
		'from_doctype': 'Sales Order',
		'module': 'Stock',
		'name': '__common__',
		'ref_doc_submitted': 1,
		'to_doctype': 'Delivery Note'
	},

	# DocType Mapper, Sales Order-Delivery Note
	{
		'doctype': u'DocType Mapper',
		'name': 'Sales Order-Delivery Note'
	},

	# Field Mapper Detail
	{
		'checking_operator': '>=',
		'doctype': 'Field Mapper Detail',
		'from_field': 'transaction_date',
		'map': 'No',
		'match_id': 0,
		'to_field': 'transaction_date'
	},

	# Field Mapper Detail
	{
		'doctype': 'Field Mapper Detail',
		'from_field': 'name',
		'map': 'Yes',
		'match_id': 0,
		'to_field': 'sales_order_no'
	},

	# Field Mapper Detail
	{
		'checking_operator': '=',
		'doctype': 'Field Mapper Detail',
		'from_field': 'company',
		'map': 'Yes',
		'match_id': 0,
		'to_field': 'company'
	},

	# Field Mapper Detail
	{
		'checking_operator': '=',
		'doctype': 'Field Mapper Detail',
		'from_field': 'currency',
		'map': 'Yes',
		'match_id': 0,
		'to_field': 'currency'
	},

	# Field Mapper Detail
	{
		'doctype': 'Field Mapper Detail',
		'from_field': 'shipping_address_name',
		'map': 'Yes',
		'match_id': 0,
		'to_field': 'customer_address'
	},

	# Field Mapper Detail
	{
		'doctype': 'Field Mapper Detail',
		'from_field': 'shipping_address',
		'map': 'Yes',
		'match_id': 0,
		'to_field': 'address_display'
	},

	# Field Mapper Detail
	{
		'doctype': 'Field Mapper Detail',
		'from_field': 'parent',
		'map': 'Yes',
		'match_id': 1,
		'to_field': 'prevdoc_docname'
	},

	# Field Mapper Detail
	{
		'doctype': 'Field Mapper Detail',
		'from_field': 'parenttype',
		'map': 'Yes',
		'match_id': 1,
		'to_field': 'prevdoc_doctype'
	},

	# Field Mapper Detail
	{
		'doctype': 'Field Mapper Detail',
		'from_field': 'name',
		'map': 'Yes',
		'match_id': 1,
		'to_field': 'prevdoc_detail_docname'
	},

	# Field Mapper Detail
	{
		'doctype': 'Field Mapper Detail',
		'from_field': 'eval: (flt(obj.qty) - flt(obj.delivered_qty)) * flt(obj.export_rate)',
		'map': 'Yes',
		'match_id': 1,
		'to_field': 'export_amount'
	},

	# Field Mapper Detail
	{
		'checking_operator': '=',
		'doctype': 'Field Mapper Detail',
		'from_field': 'basic_rate',
		'map': 'Yes',
		'match_id': 1,
		'to_field': 'basic_rate'
	},

	# Field Mapper Detail
	{
		'doctype': 'Field Mapper Detail',
		'from_field': 'eval: flt(obj.qty) - flt(obj.delivered_qty)',
		'map': 'Yes',
		'match_id': 1,
		'to_field': 'qty'
	},

	# Field Mapper Detail
	{
		'doctype': 'Field Mapper Detail',
		'from_field': 'eval: (flt(obj.qty) - flt(obj.delivered_qty)) * flt(obj.basic_rate)',
		'map': 'Yes',
		'match_id': 1,
		'to_field': 'amount'
	},

	# Field Mapper Detail
	{
		'doctype': 'Field Mapper Detail',
		'from_field': 'reserved_warehouse',
		'map': 'Yes',
		'match_id': 1,
		'to_field': 'warehouse'
	},

	# Field Mapper Detail
	{
		'checking_operator': '=',
		'doctype': 'Field Mapper Detail',
		'from_field': 'project_name',
		'map': 'Yes',
		'match_id': 0,
		'to_field': 'project_name'
	},

	# Field Mapper Detail
	{
		'checking_operator': '=',
		'doctype': 'Field Mapper Detail',
		'from_field': 'customer',
		'map': 'Yes',
		'match_id': 0,
		'to_field': 'customer'
	},

	# Field Mapper Detail
	{
		'doctype': 'Field Mapper Detail',
		'from_field': 'naming_series',
		'map': 'No',
		'match_id': 0,
		'to_field': 'naming_series'
	},

	# Field Mapper Detail
	{
		'doctype': 'Field Mapper Detail',
		'from_field': 'status',
		'map': 'No',
		'match_id': 0,
		'to_field': 'status'
	},

	# Field Mapper Detail
	{
		'doctype': 'Field Mapper Detail',
		'from_field': 'incentives',
		'map': 'No',
		'match_id': 3,
		'to_field': 'incentives'
	},

	# Field Mapper Detail
	{
		'doctype': 'Field Mapper Detail',
		'from_field': 'allocated_amount',
		'map': 'Yes',
		'match_id': 0,
		'to_field': 'customer_mobile_no'
	},

	# Table Mapper Detail
	{
		'doctype': 'Table Mapper Detail',
		'from_field': 'sales_team',
		'from_table': 'Sales Team',
		'match_id': 3,
		'to_field': 'sales_team',
		'to_table': 'Sales Team',
		'validation_logic': 'name is not null'
	},

	# Table Mapper Detail
	{
		'doctype': 'Table Mapper Detail',
		'from_field': 'other_charges',
		'from_table': 'RV Tax Detail',
		'match_id': 2,
		'to_field': 'other_charges',
		'to_table': 'RV Tax Detail',
		'validation_logic': 'name is not null'
	},

	# Table Mapper Detail
	{
		'doctype': 'Table Mapper Detail',
		'from_field': 'sales_order_details',
		'from_table': 'Sales Order Detail',
		'match_id': 1,
		'reference_doctype_key': 'prevdoc_doctype',
		'reference_key': 'prevdoc_detail_docname',
		'to_field': 'delivery_note_details',
		'to_table': 'Delivery Note Detail',
		'validation_logic': 'qty > ifnull(delivered_qty,0) and docstatus = 1'
	},

	# Table Mapper Detail
	{
		'doctype': 'Table Mapper Detail',
		'from_table': 'Sales Order',
		'match_id': 0,
		'reference_key': 'prevdoc_docname',
		'to_table': 'Delivery Note',
		'validation_logic': 'docstatus = 1'
	}
]